package com.xiaoming.api;

import com.xiaoming.base.ResponseBase;
import com.xiaoming.entity.User;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *   服务类
 * </p>
 *
 * @author xiaoming
 * @since 2020-03-10
 */

public interface IUserService  {
    /**
     * 根据openId查询用户
     * @param openId
     * @return
     */
    @RequestMapping("/user/findUserByOpenId")
    ResponseBase findUserByOpenId(@RequestParam("openId") String openId);

    /**
     * 通过openId登录
     * @param user
     * @return
     */
    @PostMapping("/user/qqLoginOpenId")
    ResponseBase qqLoginOpenId(@RequestBody User user);

    /**
     *根据令牌查找用户
     * @param token
     * @return
     */
    @GetMapping("/user/findUserByToken")
    ResponseBase findUserByToken(@RequestParam String token);

    /**
     * 用户登陆
     * @param user
     * @return
     */
    @PostMapping("/user/login")
    ResponseBase login(@RequestBody User user);


    /**
     * 使用userId查找用户信息
     * @param userId
     * @return
     */
    @GetMapping("/user")
    ResponseBase findUserById(@RequestParam Long userId);

    /**
     * 注册会员
     * @param user
     * @return
     */
    @PostMapping("/user")
    ResponseBase registerUser(@RequestBody User user);


    /**
     * 跟新会员
     * @param user
     * @return
     */
    @PutMapping("/user")
    ResponseBase updateUser(@RequestBody User user);
}
